﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Resto.CostControl.Core.Query.SupplierModule.QueryObject;
using Enterprise.Framework.Core.Container;
using Resto.CostControl.Core.Query.SupplierModule.ViewObject;

namespace Resto.CostControl.WebControl.Service.SelectListAdapter
{
    internal class SupplierQuery : ISelectListItemQuery
    {
        public List<SelectListItem> QuerySelectListItem()
        {
            SupplierQO supplierQO = ObjectCreator.Create<SupplierQO>();
            SupplierVO[] array = supplierQO.QueryAllSupplierVO();

            List<SelectListItem> list = new List<SelectListItem>();
            foreach (SupplierVO obj in array)
            {
                SelectListItem item = new SelectListItem()
                {
                    Text = obj.Name,
                    Value = obj.ID.ToString(),
                };

                list.Add(item);
            }

            return list;
        }
    }
}
